<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //遍历所有的字符
        let str = '黑色幽默';
        //1. 索引号
        for(let i = 0;i<str.length;i++){
        console.log(str.charAt(i));
    }


    //2. for -in
    for( let i in str) {
        console.log(i, str[i]);
    }



    //3.for-of
     
     for(let i of str ){
        console.log(i);
     }
</script>
</body>
</html>